import React from 'react';
import { Message } from 'antd';
// import ErrorMsg from '../ErrorMsg/index';
import * as event from '../../utils/event/componentEvent';
class Msg extends React.Component {
  constructor(props) {
    super(props);
    this.state = {};
  }
  componentDidMount() {
    event.eventEmitter.on(event.SHOW_ERROR_MSG, msg => {
      Message.error(msg);
    });
    event.eventEmitter.on(event.SHOW_WARNING_MSG, msg => {
      Message.warning(msg);
    });
    event.eventEmitter.on(event.SHOW_SUCCESS_MSG, msg => {
      Message.success(msg);
    });
    event.eventEmitter.on(event.SHOW_INFO_MSG, msg => {
      Message.info(msg);
    });
  }
  componentWillUnmount() {
    event.eventEmitter.removeAllListeners([
      event.SHOW_ERROR_MSG,
      event.SHOW_WARNING_MSG,
      event.SHOW_SUCCESS_MSG,
      event.SHOW_INFO_MSG
    ]);
  }
  render() {
    return <></>;
  }
}

export default Msg;
